package com.rmd.ai.grpc.service;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 * <pre>
 *瑞明达 AI 异步多路IO Grpc 服务
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.11.0)",
    comments = "Source: chat.proto")
public final class RmdChatServiceGrpc {

  private RmdChatServiceGrpc() {}

  public static final String SERVICE_NAME = "com.rmd.ai.grpc.service.RmdChatService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getArticleMethod()} instead. 
  public static final io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Chat.RmdChatRequest,
      com.rmd.ai.grpc.service.Chat.RmdChatResponse> METHOD_ARTICLE = getArticleMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Chat.RmdChatRequest,
      com.rmd.ai.grpc.service.Chat.RmdChatResponse> getArticleMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Chat.RmdChatRequest,
      com.rmd.ai.grpc.service.Chat.RmdChatResponse> getArticleMethod() {
    return getArticleMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Chat.RmdChatRequest,
      com.rmd.ai.grpc.service.Chat.RmdChatResponse> getArticleMethodHelper() {
    io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Chat.RmdChatRequest, com.rmd.ai.grpc.service.Chat.RmdChatResponse> getArticleMethod;
    if ((getArticleMethod = RmdChatServiceGrpc.getArticleMethod) == null) {
      synchronized (RmdChatServiceGrpc.class) {
        if ((getArticleMethod = RmdChatServiceGrpc.getArticleMethod) == null) {
          RmdChatServiceGrpc.getArticleMethod = getArticleMethod = 
              io.grpc.MethodDescriptor.<com.rmd.ai.grpc.service.Chat.RmdChatRequest, com.rmd.ai.grpc.service.Chat.RmdChatResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "com.rmd.ai.grpc.service.RmdChatService", "Article"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.rmd.ai.grpc.service.Chat.RmdChatRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.rmd.ai.grpc.service.Chat.RmdChatResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new RmdChatServiceMethodDescriptorSupplier("Article"))
                  .build();
          }
        }
     }
     return getArticleMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static RmdChatServiceStub newStub(io.grpc.Channel channel) {
    return new RmdChatServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static RmdChatServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new RmdChatServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static RmdChatServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new RmdChatServiceFutureStub(channel);
  }

  /**
   * <pre>
   *瑞明达 AI 异步多路IO Grpc 服务
   * </pre>
   */
  public static abstract class RmdChatServiceImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     *rpc Chat (RmdChatRequest) returns (stream RmdChatResponse) {} // 流事对话
     * </pre>
     */
    public void article(com.rmd.ai.grpc.service.Chat.RmdChatRequest request,
        io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Chat.RmdChatResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getArticleMethodHelper(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getArticleMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.rmd.ai.grpc.service.Chat.RmdChatRequest,
                com.rmd.ai.grpc.service.Chat.RmdChatResponse>(
                  this, METHODID_ARTICLE)))
          .build();
    }
  }

  /**
   * <pre>
   *瑞明达 AI 异步多路IO Grpc 服务
   * </pre>
   */
  public static final class RmdChatServiceStub extends io.grpc.stub.AbstractStub<RmdChatServiceStub> {
    private RmdChatServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private RmdChatServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RmdChatServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new RmdChatServiceStub(channel, callOptions);
    }

    /**
     * <pre>
     *rpc Chat (RmdChatRequest) returns (stream RmdChatResponse) {} // 流事对话
     * </pre>
     */
    public void article(com.rmd.ai.grpc.service.Chat.RmdChatRequest request,
        io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Chat.RmdChatResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getArticleMethodHelper(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   *瑞明达 AI 异步多路IO Grpc 服务
   * </pre>
   */
  public static final class RmdChatServiceBlockingStub extends io.grpc.stub.AbstractStub<RmdChatServiceBlockingStub> {
    private RmdChatServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private RmdChatServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RmdChatServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new RmdChatServiceBlockingStub(channel, callOptions);
    }

    /**
     * <pre>
     *rpc Chat (RmdChatRequest) returns (stream RmdChatResponse) {} // 流事对话
     * </pre>
     */
    public com.rmd.ai.grpc.service.Chat.RmdChatResponse article(com.rmd.ai.grpc.service.Chat.RmdChatRequest request) {
      return blockingUnaryCall(
          getChannel(), getArticleMethodHelper(), getCallOptions(), request);
    }
  }

  /**
   * <pre>
   *瑞明达 AI 异步多路IO Grpc 服务
   * </pre>
   */
  public static final class RmdChatServiceFutureStub extends io.grpc.stub.AbstractStub<RmdChatServiceFutureStub> {
    private RmdChatServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private RmdChatServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RmdChatServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new RmdChatServiceFutureStub(channel, callOptions);
    }

    /**
     * <pre>
     *rpc Chat (RmdChatRequest) returns (stream RmdChatResponse) {} // 流事对话
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.rmd.ai.grpc.service.Chat.RmdChatResponse> article(
        com.rmd.ai.grpc.service.Chat.RmdChatRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getArticleMethodHelper(), getCallOptions()), request);
    }
  }

  private static final int METHODID_ARTICLE = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final RmdChatServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(RmdChatServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_ARTICLE:
          serviceImpl.article((com.rmd.ai.grpc.service.Chat.RmdChatRequest) request,
              (io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Chat.RmdChatResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class RmdChatServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    RmdChatServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.rmd.ai.grpc.service.Chat.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("RmdChatService");
    }
  }

  private static final class RmdChatServiceFileDescriptorSupplier
      extends RmdChatServiceBaseDescriptorSupplier {
    RmdChatServiceFileDescriptorSupplier() {}
  }

  private static final class RmdChatServiceMethodDescriptorSupplier
      extends RmdChatServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    RmdChatServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (RmdChatServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new RmdChatServiceFileDescriptorSupplier())
              .addMethod(getArticleMethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}
